package lanqiao13;

import java.util.Arrays;

import com.sun.org.apache.regexp.internal.recompile;

public class B {
private static long count = 0;
	
	public static void main(String[] args) {
		// 14个错排列              n!/0! - n!/1! + n!/2! + ··· + (-1)^n * n!/n!
		System.out.println(f(14));
	}
	
	private static long f(int n) {
		long sum = name(n);
		for (int i = 1; i <= n; i++) {
			sum += Math.pow(-1, i) * name(n) / name(i);
		}
		
		return sum;
	}
	
	private static long name(int n) {
		if (n == 1) {
			return 1;
		}
		
		return n * name(n - 1);
	}
	
	private static long name1(int n) {
		if (n == 15) {
			return 15;
		}
		
		return n * name(n - 1);
	}
}
